//
//  UIButton+Extension.swift
//  weibo
//
//  Created by shixinPeng on 16/3/9.
//  Copyright © 2016年 shixinPeng. All rights reserved.
//

import UIKit
/*
扩展的构造方法
*/
extension UIButton {
    
    convenience init(title:String ,imageStr: String?, SelectImageStr: String?,targer: AnyObject?, action:Selector ){
    
    self.init()
        self.setTitle(title, forState: .Normal)
    //设置属性
        if let Oimge = imageStr{
            
            self.setBackgroundImage(UIImage(named: Oimge) , forState: .Normal)
        }
        if let OselectImageStr = SelectImageStr{
            
            self.setBackgroundImage(UIImage(named: OselectImageStr), forState:.Selected)
        }
        
    
    self.addTarget(targer, action: action, forControlEvents: .TouchUpInside)
        
    }

}